<?php

namespace App\Listeners\Takebook;

use App\Events\TakebookUpdated;
use App\Morefun\Takebook\RedisSynchronizer;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

class RewriteTakebookToRedis
{
    protected $synchronizer;
    /**
     * Create the event listener.
     * @param RedisSynchronizer $synchronizer
     */
    public function __construct(RedisSynchronizer $synchronizer)
    {
        $this->synchronizer = $synchronizer;
    }

    /**
     * Handle the event.
     *
     * @param  TakebookUpdated  $event
     * @return void
     */
    public function handle(TakebookUpdated $event)
    {
        $this->synchronizer->write($event->activity);
    }
}
